<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>安装通-[#if enquiry.qtype == 1]设计[#else]采购[/#if]询价详情</title>
<link href="/res/css/respective/priceAsk/buyer.css" rel="stylesheet">
</head>
<body>
[#assign menucode="pushEnquiry"/]
	<div class="warp">
		[#include "/front/common/front_headAzt.html"]
		<div class="backcontent">
			[#include "/front/common/front_leftAzt.html"]
			[#if enquiry??]
			<form  role="form">
			<div class="back-main">
				<div class="mainContent">
		<div class="mainContentWhite">
			<h1>[#if enquiry.qtype == 1]预算[#else]采购[/#if]询价详情</h1>
			<hr>
			 <input name="enquiryId" type="hidden" value="${enquiry.id!}"  id="enquiryId"/>
			 <input name="projectId" type="hidden" value="${enquiry.projectId!}"  id="projectId"/>
			 <input name="taxInstro" type="hidden" value="${enquiry.taxInstro!}" id="taxInstro"/>
			 <input name="canQuote" type="hidden" value="${canQuote!1}" id="canQuote"/>
			 <input name="attachfile" type="hidden" id="attachfile"/>
			 <input name="qtype" type="hidden" value="${enquiry.qtype!}"/>
			 <input type="hidden" id="topuPath" />
			 <input type="hidden" id="solvePath" />
			 <h2>基本信息</h2>
			 <div class="baseInfo">
								<div>
									<dfn>
										询价名称：<span class="ellipsis">${enquiry.enquiryName!}</span>
									</dfn>
									<dfn>
										[#assign realCompanyName = '']
										[#if enquiry.ppCompany??]
											[#assign realCompanyName = enquiry.ppCompany!]
										[#elseif enquiry.parentCompany??]
											[#assign realCompanyName = enquiry.parentCompany!]
										[#else]
											[#assign realCompanyName = enquiry.companyName!]
										[/#if]
										发布公司：<span>${myStringUtils.hideCompanyName(realCompanyName)}</span>
									</dfn>
								</div>
								<div>
									<dfn>
										项目名称：<span>${enquiry.projectName!}</span>
									</dfn>
									<dfn>
										质保要求：<span>[#if enquiry.quality??]${enquiry.quality!}年[#elseif enquiry.guaranteeinfo??]${enquiry.guaranteeinfo!}[/#if]</span>
									</dfn>
								</div>
								<div>
									<dfn>
										报价截止时间：<span>${enquiry.deadline?string('yyyy-MM-dd')}</span>
									</dfn>
									<dfn>
										是否含税：
										<span>
											[#if enquiry.taxPrice??]
												[#if enquiry.taxPrice < 3]含税[#if enquiry.taxInstro??]（税率：${enquiry.taxInstro!0}%）[/#if][/#if]
												[#if enquiry.taxPrice==3]不含税[/#if]
											[/#if]
										</span>
									</dfn>
								</div>
								<div>
									<dfn>
										是否含运费：<span>[#if enquiry.shipPrice??]${(enquiry.shipPrice == 1)?string('包含运费' , '不包含运费')}[/#if]</span>
									</dfn> 
										<div style="position: relative;display: inline-block;margin-bottom: 0;height: 21px;">[#if enquiry.qtype == 2] <dfn>支付方式：<span>${enquiry.paymentStr!} [/#if]</span>
                                        [#if enquiry.payment?? && enquiry.payment == 3]<a class="fqDetail" data-type="fqDetail">详情</a>[/#if]
                                </dfn>
											<div class="fqCont">
												<p class="grayArrow">
											<span class="whiteArrow">
											</span>
												</p>
												[#if batchPay??]
												[#list batchPay as bp]
												[#if bp['no']?? && bp['no'] > 0]<hr></hr>[/#if]
												<div>
													<div>
														<em class="qs">第${(bp['no']!0) + 1}期</em>
														<span>付款：</span>
														<em>${bp['per']!}%</em>
													</div>
													<div>
														<span>备注：</span>
														<em class="bzCont">${bp['remark']!}</em>
													</div>
												</div>
												[/#list]
												[/#if]
											</div></div>
								</div>
								<div>
									<dfn>
										项目所在地：<span>${enquiry.provinceName!}&nbsp;${enquiry.cityName!}</span>
									</dfn> 
								</div>
								<hr>
								[#if enquiry.qtype == 1]
								 <div>
								 	<dfn>
										 需要供应商提供：<span>${enquiry.replaceProvideFiles!}</span>
									</dfn> 
								 </div>
								 [/#if] 
								<!--<hr/>-->
								<div>
									<dfn>
										 收货人：<span>****</span>
										<!--<dfn style="vertical-align: top;color: rgb(254, 169, 16);">&nbsp;&nbsp;报价后可看</dfn>-->
									</dfn> 
									<dfn>
										联系电话：<span>${enquiry.hidePhone!}</span>
										<!--<dfn style="vertical-align: top;color: rgb(254, 169, 16);">&nbsp;&nbsp;报价后可看</dfn>-->
									</dfn> 
								</div>
								[#if enquiry.qtype == 1 && enquiry.attachfile??] 
								<div>
									<dfn style="width: auto;">
										
											 项目资料：<span>&nbsp;&nbsp;<a href="${enquiry.attachfile!}" target="_blank">下载资料</a></span>
										
									</dfn> 
								</div>
								[/#if]
								[#if enquiry.qtype == 2 && enquiry.attachfile??]
								<div>
									<dfn style="width: auto;">

											 附件：<span>&nbsp;&nbsp;<a href="${enquiry.attachfile!}" target="_blank">下载附件</a></span>

									</dfn>
								</div>
								[/#if]
								<hr/>
								<div class="othNed" [#if !enquiry.otherRemarks?? || enquiry.otherRemarks =='']style="display:none;"[/#if]>
									<dfn style="width: auto;">
										其他要求：
									</dfn> 
									<span style="vertical-align: top;display: inline-block;width: 700px;">${enquiry.otherRemarks!}</span>
								</div>
								<div> 
										[#if enquiry.qtype == 1]
											[#if enquiry.replaceProvideFiles?? && enquiry.replaceProvideFiles?contains('拓扑图')]
													 <dfn>
													 	<span>*</span>拓扑图：<a href="javascript:void(0)" id="topuUpload" style="width: 70px;">上传拓扑图</a><label></label>
													 </dfn>
													 
											[/#if] 
										[/#if]
									 
										[#if enquiry.qtype == 1] 
											[#if enquiry.replaceProvideFiles?? && enquiry.replaceProvideFiles?contains('解决方案')]
													  <dfn>
													  	<span>*</span>解决方案：<a href="javascript:void(0)" id="solveUpload" style="width: 80px;">上传解决方案</a><label></label> 
													  </dfn>
											[/#if]
										[/#if] 
								</div>
			</div> 
			<h2>报价清单</h2>
			<div style="text-align: center;">
									[#if enquiry.qtype == 2 || (enquiry.qtype == 1 && enquiry.excelpath?? && enquiry.excelpath != '')]
									<div class="quoteStep" style="padding-left: 0px;">
										<h3 style="text-align: left;">第一步</h3>
										<div style="padding-left: 0px;">
											<img alt="" src="/res/images/priceAsk/ask13.jpg"/>
										</div>
										<div style="text-align: left;padding-left: 15px;">
											<!--<h4>询价清单：  -->
												<!--<a href="${enquiry.excelpath!}" >${enquiry.excelName!}</a>-->
											<!--</h4>-->
											<h5>请下载采购商需要询价的产品清单，填写相关产品价格。</h5>
											<button class="downButt downList" onclick="downItem(${enquiry.id!} , ${enquiry.qtype!})"  type="button">下载询价清单</button>
											<button class="downButt downList" id="testButton" onclick="downItemTest(${enquiry.id!} , ${enquiry.qtype!})"  type="button" style="display:none;">下载测试清单</button>
										</div>
									</div>
									<div class="quoteStep cantUp">
										<h3 style="text-align: left;">第二步</h3>
										<div style="padding-left: 0px;">
											<img alt="" src="[#if needDown]/res/images/priceAsk/ask15.jpg[#else]/res/images/priceAsk/ask14.png[/#if]"/>
										</div>
										<div style="text-align: left;padding-left: 15px;">
											<h4 id="needUpload">上传报价</h4>
											<h5>产品价格填写完毕后，请上传报价清单。</h5>
											[#if needDown]<button class="disableButt" type="button" style="background: #fcfcfc;"  onclick="needDown();">上传报价清单</button>[/#if]
											<button class="downButt" type="button" id="fileUpload" style="[#if needDown]display: none;[/#if]" >上传报价清单</button>
											<input name="excelpath" type="hidden"  id="excelpath"/>
											<input name="excelName" type="hidden"  id="excelName"/>
										</div>
									</div>
									[#else]
										 <div class="quoteStep"  style="margin: 0px auto;width: 400px;padding-left: 0px;">
											<div>
												<img alt="" src="/res/images/priceAsk/ask14.png"/>
											</div>
											<div style="text-align: left;padding-left: 15px;">
												<h4>上传报价</h4>
												<h5>产品价格填写完毕后，请上传报价清单。</h5>
												<button class="downButt" type="button" id="fileUpload" >上传报价清单</button>
                                                <a  href="/res/excel/报价模板.xls" style="color:#00a8e6;vertical-align:middle;margin-left:10px;display: inline-block;margin-top: 8px;" target="_blank" >下载报价模板</a>
												<input name="excelpath" type="hidden"  id="excelpath"/>
												<input name="excelName" type="hidden"  id="excelName"/>
											</div>
										</div>
									[/#if]
								</div>
							<div style="text-align: center;padding-left: 0;overflow: hidden;">
							<div id="quoteList"></div>
							<hr style="margin-top: 50px;"/>
							<button class="commitButt" type="button" style="float: right;" id="saveQuote">提交报价</button>
								[@rule_content code="quote_lists"/]
							</div>
		</div> 
	</div>
			</div>
				</form>
			[#else]
			抱歉，询价未找到。
		[/#if]
			<!-- 底部菜单-->
			[#include "/front/common/front_footerAzt.html"]
		</div>
 
	</div>
	<script src="/res/js/common/jquery.1.9.1.min.js"></script>
	<script src="/res/js/structure/struture.js"></script> 
	<script src="/res/js/common/common.js"></script>
	<script type="text/javascript" src="/res/third/layer/layer.js"></script>
	<script type="text/javascript" src="/res/third/layer/layer.extends.js"></script>
	<script src="/res/js/common/jquery.ellipsis.js"></script>
	<script type="text/javascript">
        var saveFlag = true;//立个flag
		$(function(){


			$(".ellipsis").ellipsis({maxWidth:290,maxLine:1});
			[#if needDown]
			$(".downList").click(function () {
				$(".cantUp").find(".disableButt").hide();
				$(".cantUp").find(".downButt").show();
				$(".cantUp").find("img").attr("src" , "/res/images/priceAsk/ask14.png");
			});
			[/#if]

			$("#fileUpload").on('click' ,function(){
				layer.fileManager({ initType : 'file' , choiseTypes : "xls,xlsx" , callback : function(data){
					if(data.length > 0){
						$("#fileUpload").html("重新上传");
						$("#fileUpload").parent().find("h4").text("上传成功："+data[0].name);
						$("#fileUpload").parent().find("#excelName").val(data[0].name);
						$("#fileUpload").parent().find("#excelpath").val(data[0].url);
						[#if enquiry.qtype == 2]
						//如果是采购询价  则直接就分析
						layer.load(2);
						$("#quoteList").load('/enquiry/analyzeQuote' ,
								{excelPath : data[0].url,excelName : data[0].name ,enquiryId : $("#enquiryId").val() , projectId : $("#projectId").val()});
						[/#if]
					}
				}});
			});


			$("#saveQuote").on('click' , function(){

			    if(!saveFlag){
			        return false;
                }

                saveFlag = false;


				var excelpath = $("#excelpath").val();
				var excelName = $("#excelName").val();

				if(excelpath == "" || excelName == ""){
					$("#fileUpload").focus();
					layer.tips('请上传报价清单！', '#needUpload' , {tips: [2, '#fb4047']});
                    saveFlag = true;
					return false;
				}

				[#if enquiry.qtype == 2]
					if($("#listitembody tr").length == 0){layer.tips('清单内容不能为空！', '#listTotal' , {tips: [2, '#fb4047']});saveFlag = true;return false;}
				[/#if]


				var solvePath = $("#solvePath").val();
				var topuPath = $("#topuPath").val();


				if(($("#topuUpload").length > 0 && topuPath == "")){
					$("#topuUpload").focus();
					layer.tips('请上传拓扑图！', '#topuUpload' , {tips: [2, '#fb4047']});
                    saveFlag = true;
					return false;
				}
				if(($("#solveUpload").length > 0 && solvePath == "")) {
					$("#solveUpload").focus();
					layer.tips('请上传解决方案！', '#solveUpload', {tips: [2, '#fb4047']});
                    saveFlag = true;
					return false;
				}

				var attPath = [];

				attPath.push(solvePath);
				attPath.push(topuPath);

				$("#attachfile").val(attPath.join(";"));

				$.ajax({
					url : '/enquiry/saveQuote' ,
					type : 'post' ,
					dataType : 'json' ,
					data :  $("form").serialize(),
					success : function (data) {
                        saveFlag = true;
						if(data.success){
							layer.msg("报价[#if enquiry.qtype == 1]提交[/#if]成功！" , {time:1000} , function(){
								[#if enquiry??]location.href = "/enquiry/quote_${enquiry.qtype}/list";[/#if]
							});
						}else{
							if(data.msg == "cantQuote"){
								layer.alert("抱歉！请先完善您个人资料中的姓名和手机号码才能进行报价！" , {btn: ['前往完善'] , icon : 2 , title : "完善资料"} , function(){
									location.href = "/safecenter/personalData";
								});
							}else{
								layer.msg(data.msg , {time:2500});
							}
						}
					},
                    error : function () {
                        saveFlag = true;
                    }
				});

			});


			if($("#topuUpload")){
				$("#topuUpload").on('click' ,function(){
					layer.fileManager({callback : function(data){
						if(data.length > 0){
							$("#topuUpload").html("重新上传");
							$("#topuUpload").parent().find("label").html("&nbsp;" + data[0].name);
							$("#topuPath").val(data[0].url);
						}
					}});
				});
			}

			if($("#solveUpload")) {
				$("#solveUpload").on('click' ,function(){
					layer.fileManager({initType : 'file' , callback: function (data) {
						if (data.length > 0) {
							$("#solveUpload").html("重新上传");
							$("#solveUpload").parent().find("label").html("&nbsp;" + data[0].name);
							$("#solvePath").val(data[0].url);
						}
					}
					});
				});
			}

            $(".baseInfo .fqDetail").hover(function(){
                        $(".fqCont").show();
                    },
                    function(){
                        $(".fqCont").hide();
                    });


			var canQuote = "${canQuote}";
			if(canQuote != "1"){
				layer.alert("抱歉！请先完善您个人资料中的姓名和手机号码才能进行报价！" , {btn: ['前往完善'] , icon : 2 , title : "完善资料"} , function(){
					location.href = "/safecenter/personalData";
				});
				return false;
			}
		});

		function downItem(enquiryId , qtype){
			location.href = '/enquiry/exportItem?enquiryId='+enquiryId+"&qtype="+qtype;
		}


		var hn = location.hostname;

		if(hn == 'test.zht360.com') {
			$("#testButton").show();
			function downItemTest(enquiryId , qtype){
				location.href = '/enquiry/exportItemForTest?enquiryId='+enquiryId+"&qtype="+qtype;
			}
		}else{
			$("#testButton").remove();
		}


		function needDown(){
			layer.alert("请先下载清单，填写价格再上传！" , {icon : 7 , title : '警告'});
		}

	</script>
</body>
</html>
